{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/header.html"}


<!--header stop-->
{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/common/headertitle.html"}


<div class="wp_fixed" style="top:90px;">
<section class="wrap">

    <!--content stop-->



    <div class="login lr">
        <div class="lor" style="padding:5px 0;font-size:16px;"><span class="fl tar w60 lh30p">用户名</span>
            <div style="padding-left:65px;"><input class="lt" type="text" style="color:#000;" name="username" placeholder="请输入用户名"/></div></div>
        <div class="lor " style="padding:5px 0;font-size:16px;"><span class="fl tar w60 lh30p">密　码</span>
            <div style="padding-left:65px;"><input class="lt" style="color:#000;" type="password" name="password" placeholder="请输入密码"/> <input type="hidden" name="back_url" value="{$back_url}"/></div></div>

        <div class="lor " style="padding:5px 0;font-size:16px; clear: both;"><span class="fl tar w60 lh30p">验证码</span>
            <div style="padding-left:65px;"><input class="lt fl" style="color:#000; width: 50%;" type="text" name="code" placeholder="请输入验证码"/><img src="/login/code" style="  float: left;height: 25px;margin-top: 5px;width: 92px;" id="login_code_img" onclick="change_code()" width="100%" height="40"  /><p style="clear: both;"></p></div></div>
    </div>

    <section class="login">
        <ul>
            <!--<li><input class="login-text" type="text" name="username" placeholder="请输入用户名"/></li>
            <li><input class="login-text" type="password" name="password" placeholder="请输入密码"/>
                <input type="hidden" name="back_url" value="{$back_url}"/>
            </li>
            <li><input class="login-code" type="text" name="code" placeholder="输入验证码"/>
            <div class="code-pic"><img src="/login/code"  id="login_code_img" onclick="change_code()" width="100%" height="40"  /></div></li>
           -->
            <li><a href="/register" class="fl blue" style="font-size:16px;">免费注册</a><a href="/findpasswd" class="fr" style="font-size:16px;">找回密码</a></li>
             <li><input class="login-btn" type="submit" style="font-size:18px;height:42px;" value="登录"/></li>
            
        </ul>
    </section>

     <section class="login" style="width:100%;margin-top:100px;">
        <ul>
            <li class="login_title tac" style="padding-bottom:20px;"><i></i>合作账号登录<i></i></li>
            <li class="coo_panel">
                <ul>
                    <li><p class="btn_qq" onclick="javascript:window.open('/login/qqlogin');"></p></li>
                    <li><p class="btn_weibo"  onclick="javascript:window.open('/login/sinalogin');"></p></li>
                    <li><p class="btn_weixin" onclick="javascript:window.open('/login/weixin');"></p></li>
                </ul>
            </li>
        </ul>
    </section>

    <!--content end-->


</section>
</div>
{literal}
<script>
    function change_code(){
        var img = document.getElementById('login_code_img');
        img.src = '/login/code/rand/' + Math.random();
    };




    $(function(){
        $(".login-btn").click(function(){
            var username =  $("input[name=username]").val();
            var password =  $("input[name=password]").val();
            var code =  $("input[name=code]").val();
            var back_url = $('input[name=back_url]').val();
            $.ajax({
                url:'/login/login',
                data:{username:username,password:password,code:code,back_url:back_url},
                type:'POST',
                success:function(data){
                    var data = eval("("+data+")");
                    var code = data.code;
                    var msg = data.msg;

                    var back_url = data.back_url;
                    if(code == 1004){
                        alert(data.msg);
                        change_code();
                        return;
                    }
                    if(code == 1008){
                        if(back_url != ''){
                            window.location.href=back_url;
                        }else{
                            window.location.href = "/user";
                        }
                    }else{
                        alert(data.msg);
                        return;
                    }
                    return false;
                },
                dataType:'text'
            });
        });
    });
</script>
{/literal}
{include file = $smarty.const.APPLICATION_PATH|cat:"/application/views/footer.html"}
